// 封装公司角色设置相关接口

import request from '@/utils/request'

// 获取角色列表
export const getRoleListApi = (params) => {
  return request({
    url: '/sys/role',
    method: 'get',
    params
  })
}

// 获取角色信息
export const getRoleInfoApi = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'get'
  })
}

// 添加角色
export const addRoleApi = (data) => {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

// 修改角色
export const editRoleApi = (data) => {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

// 删除角色
export const deleteRoleApi = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

// 获取公司信息
export const getCompanyInfoApi = (id) => {
  return request({
    url: `/company/${id}`,
    method: 'get'
  })
}

// 保存角色权限
export const saveRoleAuthApi = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
